package com.usian.controller;

import com.github.pagehelper.PageInfo;
import com.usian.pojo.Product;
import com.usian.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;

    @RequestMapping("/findAll")
    public List<Product> findAll(Product product){
        return productService.findAll(product);
    }

    @RequestMapping("/productAdd")
    public void add(@RequestBody Product product){
        productService.add(product);
    }

    @RequestMapping("/productUd")
    public void etid(@RequestBody Product product){
        productService.etid(product);
    }

    @RequestMapping("/productDel")
    public void del(Integer id){
        productService.del(id);
    }
}
